# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python2-flake8
_pkgname=flake8
epoch=1
pkgver=3.8.4
pkgrel=3
pkgdesc='The modular source code checker: pep8, pyflakes and co.'
url='https://pypi.org/project/flake8/#files'
arch=('any')
license=('MIT')
depends=('python2' 'python2-mccabe' 'python2-enum34' 'python2-pyflakes'
         'python2-entrypoints' 'python2-pycodestyle' 'python2-configparser'
         'python2-functools32' 'python2-typing')
makedepends=('python2-setuptools')
provides=('flake8-python2')
replaces=('flake8-python2')
conflicts=('flake8-python2')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
        'setup.cfg.patch')
sha512sums=('51ed09beed50175573e6184b404431b3f89aa6594c40c70ed8288982fe12c2a68992e36d69c99013188f03555bf9fef1ba4f111f8e389cef1e1daa69b41ff5b0'
            'fb1e366e6484b6f628ef7921139b6387aa3da96550cf3c660c27395500cabdd5d5622b4e8e3aaab349f64319745d160464dc82cee5c5fd0297c2cd7a7c21e564')

prepare() {
  patch -p1 < setup.cfg.patch
}

build() {
  cd "$_pkgname-$pkgver"

  python2 setup.py build
}

package() {
  cd "$_pkgname-$pkgver"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  mv "$pkgdir/usr/bin/$_pkgname" "$pkgdir/usr/bin/${_pkgname}-2"
}

